
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2421. -- Paint -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2421: Paint</h2><span class=green>Time Limit: </span>20 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>20&nbsp;&nbsp;<span class=green>Solved: </span>16<br>[<a href='submitpage.php?id=2421'>Submit</a>][<a href='problemstatus.php?id=2421'>Status</a>][<a href='bbs.php?id=2421'>Discuss</a>]</center><h2>Description</h2><div class=content><div><span style="font-size: 12pt">话说今年</span><span style="font-size: 12pt">HNOI</span><span style="font-size: 12pt">省队集训在一中进行，为此，</span><span style="font-size: 12pt">fmsoi</span><span style="font-size: 12pt">特意准备了一个巨大的电子广告牌，准备在上面写着&ldquo;一中欢迎你&rdquo;。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">但是这块牌子却出现了问题，经过神一般的小</span><span style="font-size: 12pt">Y</span><span style="font-size: 12pt">的修理后，终于好了，可是却恢复到了默认状态</span><span style="font-size: 12pt">---</span><span style="font-size: 12pt">没有显示任何字了。显然我们还要让它显示出&ldquo;一中欢迎你&rdquo;。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">众所周知，这类广告牌通常由若干像素点构成，我们考虑其中的一行，最开始每一行都是不发光的。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">每一行有</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">个像素点，将其标号</span><span style="font-size: 12pt">1..N</span><span style="font-size: 12pt">。现在给定</span><span style="font-size: 12pt">K</span><span style="font-size: 12pt">个点，要求这</span><span style="font-size: 12pt">K</span><span style="font-size: 12pt">个点发光，其余点不能发光。而这个电子广告牌的操作方式比较畸形，它有</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">种操作方法，第</span><span style="font-size: 12pt">i</span><span style="font-size: 12pt">种为</span><span style="font-size: 12pt">U&shy;&shy;<sub>i </sub></span><span style="font-size: 12pt">，即你能将任意长为</span><span style="font-size: 12pt">U&shy;&shy;<sub>i </sub></span><span style="font-size: 12pt">的连续一段的像素状态取反，即改变发光状态。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">现在你被分配了要处理好不同的</span><span style="font-size: 12pt">T</span><span style="font-size: 12pt">行，为了节省时间，对于每一行你都必须用最少的操作次数。</span></div></div><h2>Input</h2><div class=content><div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">第一行一个数</span><span style="font-size: 12pt">T</span><span style="font-size: 12pt">，表示数据组数</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">然后是</span><span style="font-size: 12pt">T</span><span style="font-size: 12pt">组数据描述，对于每组数据：</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">第一行为</span><span style="font-size: 12pt">N,K,L</span><span style="font-size: 12pt">，即一行有</span><span style="font-size: 12pt">N</span><span style="font-size: 12pt">个点，要求</span><span style="font-size: 12pt">K</span><span style="font-size: 12pt">个点必须发光，有</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">种操作方式。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">第二行</span><span style="font-size: 12pt">K</span><span style="font-size: 12pt">个数，表示要求发光的</span><span style="font-size: 12pt">K</span><span style="font-size: 12pt">个点。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">第三行</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">个数，表示</span><span style="font-size: 12pt">L</span><span style="font-size: 12pt">种操作。</span></div></div><h2>Output</h2><div class=content><div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">包含</span><span style="font-size: 12pt">T</span><span style="font-size: 12pt">个数，每个一行，即对于每一组数据的最少操作次数。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">如果无法完成，请输出</span><span style="font-size: 12pt">-1</span></div></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>       2<br />
10 8 2<br />
1 2 3 5 6 7 8 9<br />
3 5<br />
3 2 1<br />
1 2<br />
3<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>       2<br />
       -1<br />
【数据规模】<br />
       有20%较小的数据<br />
       对于100%的数据:<br />
       T<=10<br />
N<=10000<br />
K<=10,L<=100,1<=Ui<=N</span></div><h2>HINT</h2>
			<div class=content><p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search='></a></p></div><center>[<a href='submitpage.php?id=2421'>Submit</a>][<a href='problemstatus.php?id=2421'>Status</a>][<a href='bbs.php?id=2421'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
